package cmd

import (
	"fmt"
	"github.com/spf13/cobra"
	"ir/core"
	"ir/utils"
)

var dsn string

var deployCmd = &cobra.Command{
	Use:   "deploy",
	Short: "example:ex-engine deploy",
	Run: func(cmd *cobra.Command, args []string) {
		exec()
	},
}

func init() {
	deployCmd.PersistentFlags().StringVarP(&dsn, "dsn", "d", "root:6a7a8ccd93d630eb@tcp(192.168.1.108:3306)/exengine?charset=utf8", "数据库配置")
}

func exec() {
	cfg := core.GetConfig()
	key := cfg.GetString("key")
	enDsn := utils.AesEncrypt(dsn, key)
	fmt.Println("dsn ==========>", dsn)
	fmt.Println("enDsn ==========>", enDsn)
}
